var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../lib/System/getSysTaskList", "../lib/System/getPidUsage", "../lib/System/netWorkMana", "../lib/System/getDeviceList", "../lib/System/startEXE", "koa-router", "../lib/System/getWlanInfo", "../lib/System/getBatteryReport", "../lib/System/getCPUUsage"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const getSysTaskList_1 = __importDefault(require("../lib/System/getSysTaskList"));
    const getPidUsage_1 = __importDefault(require("../lib/System/getPidUsage"));
    const netWorkMana_1 = __importDefault(require("../lib/System/netWorkMana"));
    const getDeviceList_1 = __importDefault(require("../lib/System/getDeviceList"));
    const startEXE_1 = __importDefault(require("../lib/System/startEXE"));
    const koa_router_1 = __importDefault(require("koa-router"));
    const getWlanInfo_1 = __importDefault(require("../lib/System/getWlanInfo"));
    const getBatteryReport_1 = __importDefault(require("../lib/System/getBatteryReport"));
    const getCPUUsage_1 = __importDefault(require("../lib/System/getCPUUsage"));
    const WindowsInfo = new koa_router_1.default({ prefix: '/WindowsInfo' });
    WindowsInfo
        .get('/getSysTaskList', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '成功获取操作系统进程的任务列表',
            data: await (0, getSysTaskList_1.default)()
        });
    })
        .get('/getPidUsage', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        const pid = ctx.request.query.pid;
        ctx.body = JSON.stringify({
            code: 200,
            message: '线程的使用率-' + pid,
            data: await (0, getPidUsage_1.default)(Number(pid) || 0)
        });
    })
        .get('/getNetworkList', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '获取设备网络列表',
            data: await netWorkMana_1.default.getRecently()
        });
    })
        .get('/startEXE', async (ctx) => {
        const exePath = ctx.request.query.exePath;
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '启动EXE',
            data: await (0, startEXE_1.default)(exePath)
        });
    })
        .get('/getDeviceList', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '计算机的设备列表',
            data: await (0, getDeviceList_1.default)()
        });
    })
        .get('/getCPUUsage', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '获取计算机的资源占用率',
            data: await (0, getCPUUsage_1.default)()
        });
    })
        .get('/getBatteryReport', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '获取电池报告',
            data: await (0, getBatteryReport_1.default)()
        });
    })
        .get('/getWlanInfo', async (ctx) => {
        ctx.set('Content-Type', 'application/json;charset=utf-8');
        ctx.body = JSON.stringify({
            code: 200,
            message: '无线网络连接状态',
            data: await (0, getWlanInfo_1.default)()
        });
    });
    exports.default = WindowsInfo;
});
